home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / auto1.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  2.9 KB  |  90 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8. #include <sysdefs.h>
  9. #include "..\autosrv\srvr_tlb.h"
  10. #include "auto1.h"
  11. //---------------------------------------------------------------------
  12. #pragma resource "*.dfm"
  13. TForm1 *Form1;
  14. //---------------------------------------------------------------------
  15. __fastcall TForm1::TForm1(TComponent *Owner)
  16.   : TForm(Owner)
  17. {
  18.   try
  19.   {
  20.        AutoServer.BindDefault();
  21.        EditServer = CoEditServer::Create();
  22.   }
  23.   catch (...)
  24.   {
  25.        ShowMessage("Please build and run the \\AutoSrv\\Srvr example before this one.");
  26.        Application->Terminate();
  27.   }
  28. }
  29. //---------------------------------------------------------------------
  30. void __fastcall TForm1::setvalDClick(TObject *Sender)
  31. {
  32.      AutoServer.EditStr = WideString(Edit1->Text);
  33. }
  34. //---------------------------------------------------------------------
  35. void __fastcall TForm1::getvalDClick(TObject *Sender)
  36. {
  37.      Edit1->Text = AutoServer.EditStr;
  38. }
  39. //---------------------------------------------------------------------
  40. void __fastcall TForm1::clearDClick(TObject *Sender)
  41. {
  42.      // Call a server function
  43.      AutoServer.Clear();
  44. }
  45. //---------------------------------------------------------------------
  46. void __fastcall TForm1::functionDClick(TObject *Sender)
  47. {
  48.      WideString retval;
  49.  
  50.      AutoServer.SetThreeStr(WideString("one"),WideString("two"),
  51.          WideString("three"), &retval);
  52.      Edit1->Text = retval;     
  53. }
  54. //---------------------------------------------------------------------------
  55.  
  56.  
  57. void __fastcall TForm1::setvalVClick(TObject *Sender)
  58. {
  59.      //call the server's setter function
  60.      EditServer->set_EditStr(WideString(Edit1->Text));
  61. }
  62. //---------------------------------------------------------------------------
  63.  
  64. void __fastcall TForm1::functionVClick(TObject *Sender)
  65. {
  66.      WideString p1("This ");
  67.      WideString p2("is a ");
  68.      WideString p3("test.");
  69.      WideString retval;
  70.  
  71.      // The [out, retval] parameter most come last.
  72.      EditServer->SetThreeStr(p1, p2, p3, &retval);
  73.      Edit1->Text = retval;
  74. }
  75. //---------------------------------------------------------------------------
  76.  
  77. void __fastcall TForm1::clearVClick(TObject *Sender)
  78. {
  79.      // Call a server function
  80.      EditServer->Clear();
  81. }
  82. //---------------------------------------------------------------------------
  83. void __fastcall TForm1::getvalVClick(TObject *Sender)
  84. {
  85.      WideString str;
  86.      EditServer->get_EditStr(&str);
  87.      Edit1->Text = AnsiString(str);
  88. }
  89. //---------------------------------------------------------------------------
  90.